<template>
  <div id="app">
    <div class="Login">
      <div class="header">
        <img src="../assets/logo.png" />
      </div>
      <div class="login_form">
        <el-form>
          <el-form-item>
            <el-input v-model="user"></el-input>
          </el-form-item>
          <el-form-item>
            <el-input v-model="pwd"></el-input>
          </el-form-item>
          <el-form-item class="btns">
            <el-button type="primary" @click="loginBtn">登录</el-button>
            <el-button type="info">重置</el-button>
          </el-form-item>
        </el-form>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      user: "",
      pwd: ""
    };
  },
  methods: {
    loginBtn() {
        sessionStorage.setItem("userName",this.user)
        this.$message({
            message: '登录成功!',
            type: 'success',
            duration : 2000
        })
      this.$router.push({ name: "Home" });
    }
  }
};
</script>

<style lang="less" >
#app {
  background-color: aquamarine;
  position: relative;
  .Login {
    width: 400px;
    height: 300px;
    background-color: white;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-200px, -125px);

    .header {
      padding: 10px;
      width: 100px;
      height: 100px;
      background-color: white;
      border-radius: 50%;
      border: 1px solid #eeeeee;
      position: absolute;
      left: 50%;
      transform: translate(-50px, -50px);
      img {
        width: 100px;
        height: 100px;
        border-radius: 50%;
        border: 1px solid #eeeeee;
        background-color: white;
      }
    }

    .login_form {
      position: absolute;
      bottom: 0;
      width: 100%;
      padding: 0 20px;
      box-sizing: border-box;
      .btns {
        display: flex;
        justify-content: flex-end;
      }
    }
  }
}
</style>